apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: groups.deckhouse.io
  labels:
    heritage: deckhouse
    module: user-authn
spec:
  group: deckhouse.io
  scope: Cluster
  names:
    plural: groups
    singular: group
    kind: Group
  preserveUnknownFields: false
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      additionalPrinterColumns:
      - jsonPath: .spec.name
        name: Group
        type: string
      schema:
        openAPIV3Schema:
          type: object
          description: |
            Contains information about a user group.
          required:
            - spec
          properties:
            spec:
              type: object
              required:
                - name
                - members
              properties:
                name:
                  type: string
                  description: Unique group name.
                members:
                  type: array
                  description: List of group members.
                  items:
                    type: object
                    description:
                    required:
                      - kind
                      - name
                    properties:
                      kind:
                        type: string
                        description: Type of a group member.
                        enum:
                          - User
                          - Group
                      name:
                        type: string
                        description: User or group name.
                status:
                  type: object
                  required: []
                  properties:
                    errors:
                      type: array
                      items:
                        type: object
                        properties:
                          message:
                            type: string
                          objectRef:
                            type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - User
                                  - Group
                              name:
                                type: string
